#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
const int maxn = 1e5+10;
int dp[maxn];
int main()
{
	int n,a[3];
	cin>>n>>a[0]>>a[1]>>a[2];
	memset(dp,-10000000,sizeof(dp));
	dp[0] = 0;
	for(int i = 0;i<3;i++)
	for(int j = a[i];j<=n;j++)
	{
		dp[j] = max(dp[j],dp[j-a[i]]+1);
		//printf("%d****%d****%d\n",a[i],j,dp[j]);
	}
	cout<<dp[n]<<endl;
} 
